import request from "@/utils/request";
import { Comment, ListRowsParams, ResultGoodDetail, ServiceItem } from "@/type/GoodDetailType";
import { ResponseType } from "@/type/ResponseType";

enum Enum {
   findGoodDetailAPI = "/goods/detail",
   fetchCommentRowsAPI = "/comment/listRows",
   fetchServiceAPI = "/goods.service/list"
}

/**
 * @description 获取商品详情的接口
 * */
export const findGoodDetailAPI = (goodsId: string) => request.get<ResultGoodDetail, ResponseType<ResultGoodDetail>>(Enum.findGoodDetailAPI, { params: { goodsId } });

/**
 * @description 获取商品评价的接口
 * */
export const fetchCommentRowsAPI = (params: ListRowsParams) => request.get<{ list: Comment[], total: number }, ResponseType<{ list: Comment[], total: number }>>(Enum.fetchCommentRowsAPI, { params });

/**
 * @description 获取商品保障服务的接口
 * */
export const fetchServiceAPI = (goodsId: string|number) => request.get<{ list: ServiceItem[] }, ResponseType<{ list: ServiceItem[] }>>(Enum.fetchServiceAPI, { params: { goodsId } });
